package com.noodles.mall.mp;


import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 配置mapper路径, 以及mybatis-plus的sql语言类型
 */
@Configuration
@MapperScan("com.noodles.mall.mapper")
public class MybatisPlusConfig {

    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        System.out.println("MybatisPlusConfig: mybatisPlusInterceptor 开始");
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
        System.out.println("MybatisPlusConfig: mybatisPlusInterceptor 结束");
        return interceptor;
    }

}